//index.js
//获取应用实例
let promise = require('../../utils/promise.js')

Page({
  data: {
    banners:'',
    tabBars:'',
    firstItems:'',
    hotList:'',
    topicList:'',
    newList:''
  },
  onLoad: function () {
    console.log(promise)
    promise.fetchTime({
      url:"http://localhost:8888/xm/home"
    }).then((res)=>{
      console.log('获取到的数据',res.data.data)
      this.setData({
        banners:res.data.data.banners,
        tabBars: res.data.data.tabBars,
        firstItems: res.data.data.firstItems,
        hotList: res.data.data.hotList,
        topicList: res.data.data.topicList,
        newList: res.data.data.newList,
      })
    }).catch((err)=>{
      console.log(err)
    })
  },

})
